Xbasic

SCRIPT_PLAY Function

Syntax

Success_Flag as L = SCRIPT_PLAY(C script_name)

Arguments

script_nameCharacter

The name of a script or function. The Script_Name parameter can include an optional library name if you which to specify a script that is in a different database (.alb file), or is in a dictionary of a table or set that is not attached to the current database.

Description

Returns TRUE if script was played.

Discussion

The SCRIPT_PLAY() function runs a Global Script. Returns TRUE (.T.) if the script was played. The Script_Name parameter must match the script name exactly and is case-sensitive.

The Script_Name parameter can include an optional library name if you which to specify a script that is in a different database (.ALB file), or is in a dictionary of a table or set that is not attached to the current database.

For example to play a script called "Message1" that is in the "Scripts" database, you would type:

script_play("Message1@d:\alpha5\scripts.alb")

The execution of the current script is interrupted when SCRIPT_PLAY() begins, and resumes at the point of interruption after the called script finishes. Any Xbasic statements that occur after SCRIPT_PLAY() are executed.

The SCRIPT_PLAY() command plays the script in the current session. To play a script in a new session, use the SCRIPT_SPAWN()command.

The LOAD_LIBRARY() function does not allow SCRIPT_PLAY() to run scripts. Use ADDIN.RUN() to run scripts loaded with LOAD_LIBRARY(). When creating .AEX files place scripts into functions. Do not call scripts with SCRIPT_PLAY() or SCRIPT_PLAY_LOCAL().

Example

This script plays the script Hello in the current database.

script_ran = script_play("Hello")

This script plays the script 'Goodbye' in the data dictionary C:\ALPHA5\TEST.DDD.

script_ran = script_play("Goodbye@C:\ALPHA5\TEST.DDD")

Limitations

Desktop applications only.

See Also